# 使用CMake Tools插件（可选，如果这个项目去到一个没有这个插件的机器也同样可以生成项目）
include(CMakeToolsHelpers OPTIONAL)

cmake_minimum_required(VERSION 3.0.0)
project(topology VERSION 0.0.0)

# 查找当前目录下的所有源文件
include(CTest)
enable_testing()

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# 设定发布路径
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/release/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/release/lib)

############################### OpenCV ########################
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

############################### Protobuf ########################
find_package(Protobuf REQUIRED)
include_directories(${Protobuf_INCLUDE_DIRS})

############################### OpenBLAS ########################
find_package(OpenBLAS REQUIRED)
include_directories(${OpenBLAS_INCLUDE_DIR})


############################### GLOG ########################
find_package(Glog REQUIRED)
include_directories(${GLOG_INCLUDE_DIR})

############################### GFLAGS ########################
find_package(GFlags REQUIRED)
include_directories(${GFLAGS_INCLUDE_DIR})

############################## 结束搜索 ########################
message(${CMAKE_INSTALL_PREFIX})

# 查找当前目录下的所有源文件
# 并将名称保存到 DIR_ROOT_SRCS变量
aux_source_directory(src DIR_ROOT_SRCS)

# 添加需要链接的库文件
set(INC_DIR
    ./lib
    ./include
    /usr/local/include

    
)
set(LINK_DIR
    /usr/local/lib
    /usr/lib/x86_64-linux-gnu
    /usr/lib/x86_64-linux-gnu/hdf5/serial
)

link_directories(${LINK_DIR})
include_directories(${INC_DIR})

add_definitions(-DUSE_OPENCV -DAMBER_USE_CAFFE_BLOB)
# 添加 Lib子目录
# add_subdirectory(lib)
add_executable(topology main.cpp ${DIR_ROOT_SRCS})
############################## LINK ########################
target_link_libraries(topology libhiredis.a)
target_link_libraries(topology ${OpenCV_LIBS})
############################## Caffe ########################
set(CAFFE_LIBS /usr/local/caffe/lib/libcaffe.so)
# Link your application with caffe libraries
target_link_libraries(topology ${CAFFE_LIBS})
target_link_libraries(topology ${Protobuf_LIBRARY})
target_link_libraries(topology ${OpenBLAS_LIB})
target_link_libraries(topology ${GLOG_LIBRARY})
target_link_libraries(topology ${GFLAGS_LIBRARY})
target_link_libraries(topology hdf5_serial_hl hdf5_serial)
target_link_libraries(topology libboost_thread.a libboost_filesystem.a  libboost_system.a )
target_link_libraries(topology libjsoncpp.a)



